extern time_t gpsbabel_now; /* gpsbabel startup-time; initialized in main.c with time() */
extern time_t gpsbabel_time; /* gpsbabel startup-time; initialized in main.c with current_time(), ! ZERO within testo ! */
+#define MILLI_TO_MICRO(t) (t * 1000) /* Milliseconds to Microseconds */
+#define MICRO_TO_MILLI(t) (t / 1000) /* Microseconds to Milliseconds*/
#define CENTI_TO_MICRO(t) (t * 10000) /* Centiseconds to Microseconds */
#define MICRO_TO_CENTI(t) (t / 10000) /* Centiseconds to Microseconds */
case 6:
sscanf(c, "%d:%d:%d.%d", &time.tm_hour, &time.tm_min, &time.tm_sec, &fracsec);
- wpt->microseconds = CENTI_TO_MICRO(fracsec);
- if (what == STM_TRKPT)
- wpt->microseconds /= 10;
+ wpt->microseconds = MILLI_TO_MICRO(fracsec);
+ /* makes sense only for recorded trackpoints */
+ if (what != STM_TRKPT) wpt->microseconds = 0;
break;
default:
{
case STM_WAYPT:
case STM_RTEPT:
- gbfprintf(fout, ".%02d", MICRO_TO_CENTI(wpt->microseconds));
+ gbfprintf(fout, ".%02d", 0);
break;
case STM_TRKPT:
- gbfprintf(fout, ".%03d", MICRO_TO_CENTI(wpt->microseconds * 10));
+ gbfprintf(fout, ".%03d", MICRO_TO_MILLI(wpt->microseconds));
break;
}
gbfprintf(fout, ",\r\n");